import axios from "@/utils/axios"
import  {GeBaseURL} from "@/utils/axios"



const api = {
  baseUrl:GeBaseURL(),
  article: 'api/v1/auth/article',//文章
  user: 'api/v1/auth/user',//用户
  file:"api/v1/auth/file"
  
  // Logout: '/auth/logout',
  // ForgePassword: '/auth/forge-password',
  // Register: '/auth/register',
  // twoStepCode: '/auth/2step-code'j,
  // SendSms: '/account/sms',
  // SendSmsErr: '/account/sms_err',
  // // get my info
  // UserInfo: '/user/info'
}


export  let GetRequestURL=api

export const GetControl=(group,url,params,header)=>{
  return axios.get(api[group]+'/'+ url,params,{header}).then(res=>res.data);
}

export const PostControl=(group,url,data,headers)=>{   
  return axios.post(api[group]+'/'+ url,data,{headers})
} 

export const PostAuth=(group,url,params)=>{  
	
  return axios.post(api[group]+'/'+ url,params,{headers:{Authentication:GetToken()}}) 
}

export const GetAuth=(group,url,params)=>{    
  return  axios.get(api[group]+'/'+ url,{params,headers:{Authentication:GetToken()}})
}

 export function GetToken(){
 return JSON.parse(localStorage.getItem("vuex")).isLogin.token
}